/**
 * 
 */
package com.feib.stms.dao.jdbc.rowmapper;

import java.sql.ResultSet;

import org.springframework.jdbc.core.RowMapper;

import com.feib.stms.model.Group;
import com.feib.stms.model.TempUploadFile;
import com.feib.stms.model.User;

/**
 * @author Jimmy Liu
 *
 */
public class TempUploadFileRowMapper  extends BaseRowMapper<TempUploadFile> implements RowMapper<TempUploadFile> {

	private static final long serialVersionUID = 4037809581529436383L;
	
	public TempUploadFileRowMapper() {
		super(TempUploadFile.class);
	}
	
	@Override
	protected TempUploadFile doOtherMapRow(ResultSet rs, int rowNumber, TempUploadFile entity) {
		
		Group group = new Group();
		entity.setGroup(group);
		group.setGroupPk((Long)getColumnValue(rs, "GROUP_PK", Long.class));
		
		User user = new User();
		entity.setUploadUser(user);//上傳人員 UPLOAD_USER_PK
		//塞上傳人員的關聯
		user.setUserPk((Long)getColumnValue(rs, "UPLOAD_USER_PK", Long.class));
		user.setGroup(group);
			
		return entity;
	}
}
